package com.rem.hutool.my5Utils;

import cn.hutool.core.util.NumberUtil;

import java.math.BigDecimal;

/**
 * @Author Rem
 * @Date 2020-08-23
 */

public class NumberUtilDemo {
    public static void main(String[] args) {
        BigDecimal add = NumberUtil.add(new BigDecimal(0.2), BigDecimal.ONE);
        System.err.println("加法:" + add);
        double sub = NumberUtil.sub(1.7f, 3);
        System.err.println("减法:" + sub);
        BigDecimal mul = NumberUtil.mul("12", "3.1");
        System.err.println("乘法:" + mul);
        double div = NumberUtil.div(1.3f, 0.5f, 2);
        System.err.println("除法:" + div);
        BigDecimal round = NumberUtil.round(sub, 3);
        System.err.println("保留几位小数：" + round);


    }
}
